home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / QuickdrawText.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  10.5 KB  |  345 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        QuickdrawText.h
  3.  
  4.      Contains:    Quickdraw Text Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8.5
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1983-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __QUICKDRAWTEXT__
  18. #define __QUICKDRAWTEXT__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __MIXEDMODE__
  25.     #include <MixedMode.h>
  26. #endif
  27.  
  28.  
  29.  
  30.  
  31. #if PRAGMA_ONCE
  32. #pragma once
  33. #endif
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. #if PRAGMA_IMPORT
  40. #pragma import on
  41. #endif
  42.  
  43. #if PRAGMA_STRUCT_ALIGN
  44.     #pragma options align=mac68k
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46.     #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48.     #pragma pack(2)
  49. #endif
  50.  
  51. /* new CGrafPort bottleneck ("newProc2") function, used in Unicode Text drawing */
  52. EXTERN_API_C( OSStatus )
  53. StandardGlyphs                    (void *                    dataStream,
  54.                                  ByteCount                 size);
  55.  
  56.  
  57. enum {
  58.                                                                 /* CharToPixel directions */
  59.     leftCaret                    = 0,                            /*Place caret for left block*/
  60.     rightCaret                    = -1,                            /*Place caret for right block*/
  61.     kHilite                        = 1                                /*Direction is SysDirection*/
  62. };
  63.  
  64. enum {
  65.     smLeftCaret                    = 0,                            /*Place caret for left block - obsolete */
  66.     smRightCaret                = -1,                            /*Place caret for right block - obsolete */
  67.     smHilite                    = 1                                /*Direction is TESysJust - obsolete */
  68. };
  69.  
  70. enum {
  71.                                                                 /*Constants for styleRunPosition argument in PortionLine, DrawJustified, MeasureJustified, CharToPixel, and PixelToChar.*/
  72.     onlyStyleRun                = 0,                            /* This is the only style run on the line */
  73.     leftStyleRun                = 1,                            /* This is leftmost of multiple style runs on the line */
  74.     rightStyleRun                = 2,                            /* This is rightmost of multiple style runs on the line */
  75.     middleStyleRun                = 3,                            /* There are multiple style runs on the line and this is neither the leftmost nor the rightmost. */
  76.     smOnlyStyleRun                = 0,                            /* obsolete */
  77.     smLeftStyleRun                = 1,                            /* obsolete */
  78.     smRightStyleRun                = 2,                            /* obsolete */
  79.     smMiddleStyleRun            = 3                                /* obsolete */
  80. };
  81.  
  82. /* type for styleRunPosition parameter in PixelToChar etc. */
  83. typedef short                             JustStyleCode;
  84. /*QuickTime3.0*/
  85. enum {
  86.                                                                 /* Constants for txFlags (which used to be the pad field after txFace) */
  87.     tfAntiAlias                    = 1 << 0,
  88.     tfUnicode                    = 1 << 1
  89. };
  90.  
  91.  
  92.  
  93. struct FontInfo {
  94.     short                             ascent;
  95.     short                             descent;
  96.     short                             widMax;
  97.     short                             leading;
  98. };
  99. typedef struct FontInfo                    FontInfo;
  100.  
  101. typedef short                             FormatOrder[1];
  102. typedef FormatOrder *                    FormatOrderPtr;
  103. /* FormatStatus was moved to TextUtils.i */
  104.  
  105. struct OffPair {
  106.     short                             offFirst;
  107.     short                             offSecond;
  108. };
  109. typedef struct OffPair                    OffPair;
  110.  
  111. typedef OffPair                         OffsetTable[3];
  112. typedef CALLBACK_API( Boolean , StyleRunDirectionProcPtr )(short styleRunIndex, void *dirParam);
  113. typedef STACK_UPP_TYPE(StyleRunDirectionProcPtr)                 StyleRunDirectionUPP;
  114. #if OPAQUE_UPP_TYPES
  115.     EXTERN_API(StyleRunDirectionUPP)
  116.     NewStyleRunDirectionUPP           (StyleRunDirectionProcPtr userRoutine);
  117.  
  118.     EXTERN_API(void)
  119.     DisposeStyleRunDirectionUPP       (StyleRunDirectionUPP    userUPP);
  120.  
  121.     EXTERN_API(Boolean)
  122.     InvokeStyleRunDirectionUPP       (short                    styleRunIndex,
  123.                                     void *                    dirParam,
  124.                                     StyleRunDirectionUPP    userUPP);
  125.  
  126. #else
  127.     enum { uppStyleRunDirectionProcInfo = 0x00000390 };             /* pascal 1_byte Func(2_bytes, 4_bytes) */
  128.     #define NewStyleRunDirectionUPP(userRoutine)                     (StyleRunDirectionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppStyleRunDirectionProcInfo, GetCurrentArchitecture())
  129.     #define DisposeStyleRunDirectionUPP(userUPP)                     DisposeRoutineDescriptor(userUPP)
  130.     #define InvokeStyleRunDirectionUPP(styleRunIndex, dirParam, userUPP)  (Boolean)CALL_TWO_PARAMETER_UPP((userUPP), uppStyleRunDirectionProcInfo, (styleRunIndex), (dirParam))
  131. #endif
  132. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  133. #define NewStyleRunDirectionProc(userRoutine)                     NewStyleRunDirectionUPP(userRoutine)
  134. #define CallStyleRunDirectionProc(userRoutine, styleRunIndex, dirParam) InvokeStyleRunDirectionUPP(styleRunIndex, dirParam, userRoutine)
  135. #if CALL_NOT_IN_CARBON
  136. EXTERN_API( short )
  137. Pixel2Char                        (Ptr                     textBuf,
  138.                                  short                     textLen,
  139.                                  short                     slop,
  140.                                  short                     pixelWidth,
  141.                                  Boolean *                leadingEdge)                        FOURWORDINLINE(0x2F3C, 0x820E, 0x0014, 0xA8B5);
  142.  
  143. EXTERN_API( short )
  144. Char2Pixel                        (Ptr                     textBuf,
  145.                                  short                     textLen,
  146.                                  short                     slop,
  147.                                  short                     offset,
  148.                                  short                     direction)                            FOURWORDINLINE(0x2F3C, 0x820C, 0x0016, 0xA8B5);
  149.  
  150. #endif  /* CALL_NOT_IN_CARBON */
  151.  
  152. EXTERN_API( short )
  153. PixelToChar                        (Ptr                     textBuf,
  154.                                  long                     textLength,
  155.                                  Fixed                     slop,
  156.                                  Fixed                     pixelWidth,
  157.                                  Boolean *                leadingEdge,
  158.                                  Fixed *                widthRemaining,
  159.                                  JustStyleCode             styleRunPosition,
  160.                                  Point                     numer,
  161.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x8222, 0x002E, 0xA8B5);
  162.  
  163. EXTERN_API( short )
  164. CharToPixel                        (Ptr                     textBuf,
  165.                                  long                     textLength,
  166.                                  Fixed                     slop,
  167.                                  long                     offset,
  168.                                  short                     direction,
  169.                                  JustStyleCode             styleRunPosition,
  170.                                  Point                     numer,
  171.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x821C, 0x0030, 0xA8B5);
  172.  
  173. EXTERN_API( void )
  174. DrawJustified                    (Ptr                     textPtr,
  175.                                  long                     textLength,
  176.                                  Fixed                     slop,
  177.                                  JustStyleCode             styleRunPosition,
  178.                                  Point                     numer,
  179.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x8016, 0x0032, 0xA8B5);
  180.  
  181. EXTERN_API( void )
  182. MeasureJustified                (Ptr                     textPtr,
  183.                                  long                     textLength,
  184.                                  Fixed                     slop,
  185.                                  Ptr                     charLocs,
  186.                                  JustStyleCode             styleRunPosition,
  187.                                  Point                     numer,
  188.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x801A, 0x0034, 0xA8B5);
  189.  
  190. EXTERN_API( Fixed )
  191. PortionLine                        (Ptr                     textPtr,
  192.                                  long                     textLen,
  193.                                  JustStyleCode             styleRunPosition,
  194.                                  Point                     numer,
  195.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x8412, 0x0036, 0xA8B5);
  196.  
  197. EXTERN_API( void )
  198. HiliteText                        (Ptr                     textPtr,
  199.                                  short                     textLength,
  200.                                  short                     firstOffset,
  201.                                  short                     secondOffset,
  202.                                  OffsetTable             offsets)                            FOURWORDINLINE(0x2F3C, 0x800E, 0x001C, 0xA8B5);
  203.  
  204. #if CALL_NOT_IN_CARBON
  205. EXTERN_API( void )
  206. DrawJust                        (Ptr                     textPtr,
  207.                                  short                     textLength,
  208.                                  short                     slop)                                FOURWORDINLINE(0x2F3C, 0x8008, 0x001E, 0xA8B5);
  209.  
  210. EXTERN_API( void )
  211. MeasureJust                        (Ptr                     textPtr,
  212.                                  short                     textLength,
  213.                                  short                     slop,
  214.                                  Ptr                     charLocs)                            FOURWORDINLINE(0x2F3C, 0x800C, 0x0020, 0xA8B5);
  215.  
  216. EXTERN_API( Fixed )
  217. PortionText                        (Ptr                     textPtr,
  218.                                  long                     textLength)                            FOURWORDINLINE(0x2F3C, 0x8408, 0x0024, 0xA8B5);
  219.  
  220. #endif  /* CALL_NOT_IN_CARBON */
  221.  
  222. EXTERN_API( long )
  223. VisibleLength                    (Ptr                     textPtr,
  224.                                  long                     textLength)                            FOURWORDINLINE(0x2F3C, 0x8408, 0x0028, 0xA8B5);
  225.  
  226. EXTERN_API( void )
  227. GetFormatOrder                    (FormatOrderPtr         ordering,
  228.                                  short                     firstFormat,
  229.                                  short                     lastFormat,
  230.                                  Boolean                 lineRight,
  231.                                  StyleRunDirectionUPP     rlDirProc,
  232.                                  Ptr                     dirParam)                            FOURWORDINLINE(0x2F3C, 0x8012, 0xFFFC, 0xA8B5);
  233.  
  234. EXTERN_API( void )
  235. TextFont                        (short                     font)                                ONEWORDINLINE(0xA887);
  236.  
  237. EXTERN_API( void )
  238. TextFace                        (StyleParameter         face)                                ONEWORDINLINE(0xA888);
  239.  
  240. EXTERN_API( void )
  241. TextMode                        (short                     mode)                                ONEWORDINLINE(0xA889);
  242.  
  243. EXTERN_API( void )
  244. TextSize                        (short                     size)                                ONEWORDINLINE(0xA88A);
  245.  
  246. EXTERN_API( void )
  247. SpaceExtra                        (Fixed                     extra)                                ONEWORDINLINE(0xA88E);
  248.  
  249. EXTERN_API( void )
  250. DrawChar                        (CharParameter             ch)                                    ONEWORDINLINE(0xA883);
  251.  
  252. EXTERN_API( void )
  253. DrawString                        (ConstStr255Param         s)                                    ONEWORDINLINE(0xA884);
  254.  
  255. #if TARGET_OS_MAC
  256.     #define MacDrawText DrawText
  257. #endif
  258. EXTERN_API( void )
  259. MacDrawText                        (const void *            textBuf,
  260.                                  short                     firstByte,
  261.                                  short                     byteCount)                            ONEWORDINLINE(0xA885);
  262.  
  263. EXTERN_API( short )
  264. CharWidth                        (CharParameter             ch)                                    ONEWORDINLINE(0xA88D);
  265.  
  266. EXTERN_API( short )
  267. StringWidth                        (ConstStr255Param         s)                                    ONEWORDINLINE(0xA88C);
  268.  
  269. EXTERN_API( short )
  270. TextWidth                        (const void *            textBuf,
  271.                                  short                     firstByte,
  272.                                  short                     byteCount)                            ONEWORDINLINE(0xA886);
  273.  
  274. EXTERN_API( void )
  275. MeasureText                        (short                     count,
  276.                                  const void *            textAddr,
  277.                                  void *                    charLocs)                            ONEWORDINLINE(0xA837);
  278.  
  279. EXTERN_API( void )
  280. GetFontInfo                        (FontInfo *                info)                                ONEWORDINLINE(0xA88B);
  281.  
  282. EXTERN_API( void )
  283. CharExtra                        (Fixed                     extra)                                ONEWORDINLINE(0xAA23);
  284.  
  285. EXTERN_API( void )
  286. StdText                            (short                     count,
  287.                                  const void *            textAddr,
  288.                                  Point                     numer,
  289.                                  Point                     denom)                                ONEWORDINLINE(0xA882);
  290.  
  291. EXTERN_API( short )
  292. StdTxMeas                        (short                     byteCount,
  293.                                  const void *            textAddr,
  294.                                  Point *                numer,
  295.                                  Point *                denom,
  296.                                  FontInfo *                info)                                ONEWORDINLINE(0xA8ED);
  297.  
  298.  
  299. EXTERN_API_C( void )
  300. drawstring                        (const char *            s);
  301.  
  302. EXTERN_API_C( short )
  303. stringwidth                        (const char *            s);
  304.  
  305. EXTERN_API_C( void )
  306. stdtext                            (short                     count,
  307.                                  const void *            textAddr,
  308.                                  const Point *            numer,
  309.                                  const Point *            denom);
  310.  
  311. #if OLDROUTINENAMES
  312. #define NPixel2Char(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining, styleRunPosition, numer, denom) \
  313.     PixelToChar(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining, styleRunPosition, numer, denom) 
  314. #define NChar2Pixel(textBuf, textLen, slop, offset, direction, styleRunPosition, numer, denom) \
  315.     CharToPixel(textBuf, textLen, slop, offset, direction, styleRunPosition, numer, denom)
  316. #define NDrawJust(textPtr, textLength, slop, styleRunPosition, numer, denom) \
  317.     DrawJustified(textPtr, textLength, slop, styleRunPosition, numer, denom)
  318. #define NMeasureJust(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom) \
  319.     MeasureJustified(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom)
  320. #define NPortionText(textPtr, textLen, styleRunPosition, numer, denom)\
  321.     PortionLine(textPtr, textLen, styleRunPosition, numer, denom)
  322. #endif  /* OLDROUTINENAMES */
  323.  
  324.  
  325. #if PRAGMA_STRUCT_ALIGN
  326.     #pragma options align=reset
  327. #elif PRAGMA_STRUCT_PACKPUSH
  328.     #pragma pack(pop)
  329. #elif PRAGMA_STRUCT_PACK
  330.     #pragma pack()
  331. #endif
  332.  
  333. #ifdef PRAGMA_IMPORT_OFF
  334. #pragma import off
  335. #elif PRAGMA_IMPORT
  336. #pragma import reset
  337. #endif
  338.  
  339. #ifdef __cplusplus
  340. }
  341. #endif
  342.  
  343. #endif /* __QUICKDRAWTEXT__ */
  344.  
  345.